package com.sunyzc.ebaotech.simulator;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButton;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicComboBoxRenderer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sunyzc.ebaotech.simulator.soap.ISOAPProcessor;
import com.sunyzc.ebaotech.simulator.soap.SOAPClient;
import com.sunyzc.ebaotech.simulator.ybt.IYBTProcessor;
import com.sunyzc.ebaotech.simulator.ybt.YBTClient;
import com.sunyzc.ebaotech.simulator.ybt.YBTClientConfig;

public class ClientFrame {
	private static final Logger log = LoggerFactory.getLogger(ClientFrame.class);
	private static final String frameTitle = "银保通客户端测试工具 - 1.0.0";
	private static final int minTextAreaSize = 8;
	private static final int maxTextAreaSize = 20;
	private static final String newLine = System.getProperty("line.separator");
	private static final SimpleDateFormat defaultDateFiledFormat = new SimpleDateFormat("yyyyMMdd");
	private static final SimpleDateFormat dateFormatForLog = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS ");
	private static final Map<String, IYBTProcessor> ybtProcessorMap = new HashMap<String, IYBTProcessor>();
	private static final Map<String, ISOAPProcessor> soapProcessorMap = new HashMap<String, ISOAPProcessor>();

	public static void main(String[] args) {
		launch();
	}

	public static void launch() {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			final JTextArea requestMessegeTextArea = new JTextArea();
			final JTextArea responseMessegeTextArea = new JTextArea();
			final JRadioButton ybtRadioButton = new JRadioButton("YBT   ", true);
			final JRadioButton soapRadioButton = new JRadioButton("SOAP   ", false);
			final JLabel serverHostLable = new JLabel("服务器");
			final JComboBox serverHostComboBox = new JComboBox();
			final JLabel currentDateLable = new JLabel("当前日期");
			final JTextField currentDateFiled = new JTextField();
			final JLabel clientCodeLable = new JLabel("银行");
			final JComboBox clientCodeComboBox = new JComboBox();
			final JLabel transTypeLable = new JLabel("交易");
			final JComboBox transTypeComboBox = new JComboBox();
			final JButton loadTemplateButton = new JButton("生成报文");
			final JButton sendRequestButton = new JButton("发送请求");
			final JPopupMenu responseMessegeRightClickMenu = new JPopupMenu();
			final JMenuItem clearResponseButton = new JMenuItem("清除内容");
			final JSplitPane messegePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
			final JPanel operationPanel = new JPanel();
			final JPanel mainPanel = new JPanel(new BorderLayout());
			final JFrame mainFrame = new JFrame(frameTitle);

			final JScrollPane responseMessegeScrollPane = new JScrollPane(responseMessegeTextArea);
			final JScrollPane requestMessegeScrollPane = new JScrollPane(requestMessegeTextArea);
			messegePanel.add(responseMessegeScrollPane);
			messegePanel.add(requestMessegeScrollPane);
			JPanel operationInputPanel = new JPanel(new GridLayout(0, 1));
			JPanel radioButtonPanel = new JPanel();
			radioButtonPanel.add(ybtRadioButton);
			radioButtonPanel.add(soapRadioButton);
			operationInputPanel.add(serverHostLable);
			operationInputPanel.add(serverHostComboBox);
			operationInputPanel.add(currentDateLable);
			operationInputPanel.add(currentDateFiled);
			operationInputPanel.add(clientCodeLable);
			operationInputPanel.add(clientCodeComboBox);
			operationInputPanel.add(transTypeLable);
			operationInputPanel.add(transTypeComboBox);
			JPanel operationButtonPanel = new JPanel(new GridLayout(0, 1));
			operationButtonPanel.add(loadTemplateButton);
			operationButtonPanel.add(sendRequestButton);
			operationPanel.add(radioButtonPanel);
			operationPanel.add(operationInputPanel);
			JPanel emptyPanel = new JPanel();
			operationPanel.add(emptyPanel);
			operationPanel.add(operationButtonPanel);
			responseMessegeRightClickMenu.add(clearResponseButton);
			mainPanel.add(messegePanel, BorderLayout.CENTER);
			mainPanel.add(operationPanel, BorderLayout.EAST);
			mainPanel.add(new StatePanel(), BorderLayout.SOUTH);
			mainFrame.add(mainPanel);

			messegePanel.setDividerSize(1); // 分割线为0时不可调整位置
			requestMessegeTextArea.setFont(new Font("微软雅黑", Font.PLAIN, 11));
			responseMessegeTextArea.setFont(new Font("微软雅黑", Font.PLAIN, 11));
			requestMessegeTextArea.setTabSize(2);
			responseMessegeTextArea.setTabSize(2);
			responseMessegeTextArea.setBackground(new Color(0xF7F7F7));
			responseMessegeTextArea.setEditable(false);
			operationPanel.setPreferredSize(new Dimension(155, 0));
			ButtonGroup radioButtonGroup = new ButtonGroup();
			radioButtonGroup.add(ybtRadioButton);
			radioButtonGroup.add(soapRadioButton);
			serverHostComboBox.setEditable(true);
			for (Component component : radioButtonPanel.getComponents())
				component.setFont(new Font("微软雅黑", Font.BOLD, 12));
			for (Component component : operationInputPanel.getComponents())
				component.setFont(new Font("微软雅黑", Font.PLAIN, 12));
			operationInputPanel.setPreferredSize(new Dimension((int) (operationPanel.getPreferredSize().getWidth() - 6), operationInputPanel.getComponentCount() * 22));
			for (Component component : operationButtonPanel.getComponents())
				component.setFont(new Font("微软雅黑", Font.BOLD, 12));
			operationButtonPanel.setPreferredSize(new Dimension((int) (operationPanel.getPreferredSize().getWidth() - 6), operationButtonPanel.getComponentCount() * 60));
			emptyPanel.setPreferredSize(new Dimension((int) (operationPanel.getPreferredSize().getWidth() - 6), 120));

			requestMessegeTextArea.addMouseWheelListener(new MouseWheelListener() {
				@Override
				public void mouseWheelMoved(MouseWheelEvent event) {
					if (event.isControlDown()) {
						Font currentFont = requestMessegeTextArea.getFont();
						if (event.getWheelRotation() < 0)
							requestMessegeTextArea.setFont(new Font(currentFont.getName(), currentFont.getStyle(), currentFont.getSize() >= maxTextAreaSize ? maxTextAreaSize : currentFont.getSize() + 1));
						if (event.getWheelRotation() > 0)
							requestMessegeTextArea.setFont(new Font(currentFont.getName(), currentFont.getStyle(), currentFont.getSize() <= minTextAreaSize ? minTextAreaSize : currentFont.getSize() - 1));
					} else {
						JScrollBar scrollBar = requestMessegeScrollPane.getVerticalScrollBar();
						scrollBar.setValue(scrollBar.getValue() + scrollBar.getUnitIncrement(1) * event.getWheelRotation() * event.getScrollAmount());
					}
				}
			});
			responseMessegeTextArea.addMouseWheelListener(new MouseWheelListener() {
				@Override
				public void mouseWheelMoved(MouseWheelEvent event) {
					if (event.isControlDown()) {
						Font currentFont = responseMessegeTextArea.getFont();
						if (event.getWheelRotation() < 0)
							responseMessegeTextArea.setFont(new Font(currentFont.getName(), currentFont.getStyle(), currentFont.getSize() >= maxTextAreaSize ? maxTextAreaSize : currentFont.getSize() + 1));
						if (event.getWheelRotation() > 0)
							responseMessegeTextArea.setFont(new Font(currentFont.getName(), currentFont.getStyle(), currentFont.getSize() <= minTextAreaSize ? minTextAreaSize : currentFont.getSize() - 1));
					} else {
						JScrollBar scrollBar = responseMessegeScrollPane.getVerticalScrollBar();
						scrollBar.setValue(scrollBar.getValue() + scrollBar.getUnitIncrement(1) * event.getWheelRotation() * event.getScrollAmount());
					}
				}
			});
			responseMessegeTextArea.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent event) {
					if (event.getButton() == MouseEvent.BUTTON3) // 右击
						responseMessegeRightClickMenu.show(responseMessegeTextArea, event.getX(), event.getY());
				}
			});
			messegePanel.addComponentListener(new ComponentAdapter() {
				@Override
				public void componentResized(ComponentEvent event) {
					messegePanel.setDividerLocation(1.0 / 2.0);
				}
			});
			final Map<String, YBTClientConfig> ybtClientConfigMap = SimulatorConfig.loadClientConfigMap();
			final Vector<JComboBoxItem> ybtServerHostItems = SimulatorConfig.loadYBTServerHostItems();
			final Vector<JComboBoxItem> soapServerHostItems = SimulatorConfig.loadSOAPServerHostItems();
			final Vector<JComboBoxItem> clientTransactionItems = SimulatorConfig.loadClientTransactionItems();
			final Vector<JComboBoxItem> channelTransactionItems = SimulatorConfig.loadChannelTransactionItems();
			for (JComboBoxItem comboBoxItem : ybtServerHostItems)
				serverHostComboBox.addItem(comboBoxItem);
			serverHostComboBox.setRenderer(new JComboBoxCellRenderer(serverHostComboBox.isEditable()));
			currentDateFiled.setText(defaultDateFiledFormat.format(new Date()));
			for (JComboBoxItem comboBoxItem : clientTransactionItems)
				clientCodeComboBox.addItem(comboBoxItem);
			clientCodeComboBox.setRenderer(new JComboBoxCellRenderer(clientCodeComboBox.isEditable()));
			for (JComboBoxItem comboBoxItem : clientTransactionItems.get(0).getChildrenComboBoxItem())
				transTypeComboBox.addItem(comboBoxItem);
			transTypeComboBox.setRenderer(new JComboBoxCellRenderer(transTypeComboBox.isEditable()));
			transTypeComboBox.setToolTipText(((JComboBoxItem) transTypeComboBox.getSelectedItem()).getKey());
			clearResponseButton.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().getImage(ClientFrame.class.getResource("/delete.png"))));

			ybtRadioButton.addItemListener(new ItemListener() {
				@Override
				public void itemStateChanged(ItemEvent event) {
					if (event.getStateChange() == ItemEvent.SELECTED) {
						clientCodeLable.setText("银行");
						serverHostComboBox.removeAllItems();
						for (JComboBoxItem comboBoxItem : ybtServerHostItems)
							serverHostComboBox.addItem(comboBoxItem);
						clientCodeComboBox.removeAllItems();
						for (JComboBoxItem comboBoxItem : clientTransactionItems)
							clientCodeComboBox.addItem(comboBoxItem);
					}
				}
			});
			soapRadioButton.addItemListener(new ItemListener() {
				@Override
				public void itemStateChanged(ItemEvent event) {
					if (event.getStateChange() == ItemEvent.SELECTED) {
						clientCodeLable.setText("渠道");
						serverHostComboBox.removeAllItems();
						for (JComboBoxItem comboBoxItem : soapServerHostItems)
							serverHostComboBox.addItem(comboBoxItem);
						clientCodeComboBox.removeAllItems();
						for (JComboBoxItem comboBoxItem : channelTransactionItems)
							clientCodeComboBox.addItem(comboBoxItem);
					}
				}
			});
			currentDateFiled.addKeyListener(new KeyAdapter() {
				@Override
				public void keyReleased(KeyEvent event) {
					Matcher matcher = Pattern.compile("(\\D)").matcher(currentDateFiled.getText());
					if (matcher.find())
						currentDateFiled.setText(currentDateFiled.getText().replaceAll("\\D", ""));
					if (currentDateFiled.getText().length() > defaultDateFiledFormat.toPattern().length())
						currentDateFiled.setText(currentDateFiled.getText().substring(0, defaultDateFiledFormat.toPattern().length()));
				}
			});
			clientCodeComboBox.addItemListener(new ItemListener() {
				@Override
				public void itemStateChanged(ItemEvent event) {
					if (event.getStateChange() == ItemEvent.SELECTED) {
						transTypeComboBox.removeAllItems();
						for (JComboBoxItem comboBoxItem : ((JComboBoxItem) event.getItem()).getChildrenComboBoxItem())
							transTypeComboBox.addItem(comboBoxItem);
					}
				}
			});
			transTypeComboBox.addItemListener(new ItemListener() {
				@Override
				public void itemStateChanged(ItemEvent event) {
					if (event.getStateChange() == ItemEvent.SELECTED)
						transTypeComboBox.setToolTipText(((JComboBoxItem) transTypeComboBox.getSelectedItem()).getKey());
				}
			});
			loadTemplateButton.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent event) {
					String serverHost = serverHostComboBox.getSelectedItem().toString();
					String currentDate = currentDateFiled.getText();
					if (currentDate == null || currentDate.trim().equals(""))
						currentDateFiled.setText(currentDate = defaultDateFiledFormat.format(new Date()));
					String clientCode = ((JComboBoxItem) clientCodeComboBox.getSelectedItem()).getKey();
					String requestTransType = ((JComboBoxItem) transTypeComboBox.getSelectedItem()).getKey();
					try {
						String requestMessegeText = "";
						String processorKey = serverHost.trim() + "-" + clientCode;
						String transName = clientCode + "-" + requestTransType + "@" + serverHost;
						if (ybtRadioButton.isSelected()) {
							IYBTProcessor processor = ybtProcessorMap.get(processorKey);
							if (processor == null) {
								processor = YBTClient.generateProcessor(ybtClientConfigMap.get(clientCode));
								processor.setServerHost(serverHost.trim());
								ybtProcessorMap.put(processorKey, processor);
							}
							processor.setCurrentDate(currentDate.trim());
							if (event.getButton() == MouseEvent.BUTTON1) // 左击加载报文模板正则替换后的报文内容
								requestMessegeText = processor.generateRequestBodyStr(requestTransType, null, true);
							else if (event.getButton() == MouseEvent.BUTTON3) // 右击加载报文原始模板
								requestMessegeText = processor.generateRequestBodyTemplateStr(requestTransType, true);
						} else if (soapRadioButton.isSelected()) {
							ISOAPProcessor processor = soapProcessorMap.get(processorKey);
							if (processor == null) {
								processor = SOAPClient.generateProcessor(clientCode);
								soapProcessorMap.put(processorKey, processor);
							}
							processor.setCurrentDate(currentDate.trim());
							if (event.getButton() == MouseEvent.BUTTON1) // 左击加载报文模板正则替换后的报文内容
								requestMessegeText = processor.generateRequestBodyStr(requestTransType, null, true);
							else if (event.getButton() == MouseEvent.BUTTON3) // 右击加载报文原始模板
								requestMessegeText = processor.generateRequestBodyTemplateStr(requestTransType, true);
						}
						requestMessegeTextArea.setText(requestMessegeText);
						requestMessegeTextArea.setCaretPosition(0);
						if (event.getButton() == MouseEvent.BUTTON1)
							responseMessegeTextArea.append(dateFormatForLog.format(new Date()) + "交易【" + transName + "】的报文已更新！" + newLine);
						else if (event.getButton() == MouseEvent.BUTTON2)
							responseMessegeTextArea.append(dateFormatForLog.format(new Date()) + "交易【" + transName + "】的报文已清空！" + newLine);
						else if (event.getButton() == MouseEvent.BUTTON3)
							responseMessegeTextArea.append(dateFormatForLog.format(new Date()) + "交易【" + transName + "】的报文模板已加载！" + newLine);
						responseMessegeTextArea.setCaretPosition(responseMessegeTextArea.getText().length());
					} catch (Exception e) {
						log.error(e.getMessage(), e);
						JOptionPane.showMessageDialog(mainFrame, e.getMessage(), "错误", JOptionPane.ERROR_MESSAGE);
					}
				}
			});
			sendRequestButton.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent event) {
					new Thread(new Runnable() {
						@Override
						public void run() {
							String requestMessege = requestMessegeTextArea.getText();
							String serverHost = serverHostComboBox.getSelectedItem().toString();
							String currentDate = currentDateFiled.getText();
							String clientCode = ((JComboBoxItem) clientCodeComboBox.getSelectedItem()).getKey();
							String requestTransType = ((JComboBoxItem) transTypeComboBox.getSelectedItem()).getKey();
							if (requestMessege == null || requestMessege.trim().equals("")) {
								JOptionPane.showMessageDialog(mainFrame, "请求报文为空！", "错误", JOptionPane.ERROR_MESSAGE);
								return;
							}
							if (serverHost == null || serverHost.trim().equals("")) {
								JOptionPane.showMessageDialog(mainFrame, "未填写服务器地址！", "错误", JOptionPane.ERROR_MESSAGE);
								serverHostComboBox.setSelectedItem("");
								return;
							}
							if (currentDate == null || currentDate.trim().equals(""))
								currentDateFiled.setText(currentDate = defaultDateFiledFormat.format(new Date()));
							String transName = clientCode + "-" + requestTransType + "@" + serverHost + "(" + Thread.currentThread().getName() + ")";
							responseMessegeTextArea.append(dateFormatForLog.format(new Date()) + "交易【" + transName + "】请求开始……" + newLine);
							responseMessegeTextArea.setCaretPosition(responseMessegeTextArea.getText().length());
							try {
								long start = System.currentTimeMillis();
								String processorKey = serverHost.trim() + "-" + clientCode;
								if (ybtRadioButton.isSelected()) {
									IYBTProcessor processor = ybtProcessorMap.get(processorKey);
									if (processor == null) {
										processor = YBTClient.generateProcessor(ybtClientConfigMap.get(clientCode));
										processor.setServerHost(serverHost.trim());
										ybtProcessorMap.put(processorKey, processor);
									}
									processor.setCurrentDate(currentDate.trim());
									responseMessegeTextArea.append(YBTClient.requestYBTFront(processor, requestTransType, requestMessegeTextArea.getText()));
								} else if (soapRadioButton.isSelected()) {
									ISOAPProcessor processor = soapProcessorMap.get(processorKey);
									if (processor == null) {
										processor = SOAPClient.generateProcessor(clientCode);
										soapProcessorMap.put(processorKey, processor);
									}
									processor.setCurrentDate(currentDate.trim());
									responseMessegeTextArea.append(SOAPClient.requestLSWebService(serverHost, processor, requestTransType, requestMessegeTextArea.getText()));
								}
								responseMessegeTextArea.append(newLine + dateFormatForLog.format(new Date()) + "交易【" + transName + "】完成，用时 " + (System.currentTimeMillis() - start) + " 毫秒" + newLine + newLine);
							} catch (Exception e) {
								log.error(e.getMessage(), e);
								responseMessegeTextArea.append(dateFormatForLog.format(new Date()) + "交易【" + transName + "】异常：" + e.getMessage() + newLine);
							}
							responseMessegeTextArea.setCaretPosition(responseMessegeTextArea.getText().length());
						}
					}).start();
				}
			});
			clearResponseButton.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent event) {
					responseMessegeTextArea.setText("");
				}
			});

			mainFrame.setMinimumSize(new Dimension(600, 550));
			mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
			mainFrame.setIconImage(Toolkit.getDefaultToolkit().getImage(ClientFrame.class.getResource("/favicon.png")));
			Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
			mainFrame.setSize(screenSize.width < 800 ? screenSize.width : 800, screenSize.height < 600 ? screenSize.height : 600); // 设置窗口大小
			mainFrame.setLocation((screenSize.width - mainFrame.getWidth()) / 2, (screenSize.height - mainFrame.getHeight()) / 2); // 设置窗口居中显示器显示
			mainFrame.addWindowListener(new WindowAdapter() {
				@Override
				public void windowClosing(WindowEvent event) {
					if (JOptionPane.showConfirmDialog(mainFrame, "确认退出？", "确认退出", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
						System.exit(0);
					else
						return;
				}
			});
			mainFrame.setVisible(true);
		} catch (Throwable e) {
			log.error(e.getMessage(), e);
		}
	}
}

class StatePanel extends JPanel implements Runnable {
	private static final long serialVersionUID = -4287819486060531836L;
	private static final Logger log = LoggerFactory.getLogger(ClientFrame.class);
	private JLabel usedMemoryLabel = new JLabel();
	private JLabel totalMemoryLabel = new JLabel();
	private JLabel maxMemoryLabel = new JLabel();

	public StatePanel() {
		this.add(usedMemoryLabel);
		this.add(totalMemoryLabel);
		this.add(maxMemoryLabel);
		for (Component component : getComponents())
			component.setFont(new Font("微软雅黑", Font.PLAIN, 11));
		new Thread(this).start();
	}

	public void run() {
		while (true) {
			long totalMemory = Runtime.getRuntime().totalMemory();
			long freeMemory = Runtime.getRuntime().freeMemory();
			long maxMemory = Runtime.getRuntime().maxMemory();
			usedMemoryLabel.setText("已用内存: " + (totalMemory - freeMemory) / 1024 / 1024 + "MB");
			totalMemoryLabel.setText("   总内存: " + totalMemory / 1024 / 1024 + "MB");
			maxMemoryLabel.setText("   最大内存: " + maxMemory / 1024 / 1024 + "MB");
			this.updateUI();
			try {
				Thread.sleep(100);
			} catch (Throwable e) {
				log.error(e.getMessage(), e);
			}
		}
	}
}

class JComboBoxCellRenderer extends BasicComboBoxRenderer {
	private static final long serialVersionUID = -6738842511064285419L;
	private boolean editable;

	public JComboBoxCellRenderer(boolean editable) {
		this.editable = editable;
	}

	@Override
	public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
		super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
		if (value != null)
			if (editable)
				setText(((JComboBoxItem) value).getValue());
			else
				setText(((JComboBoxItem) value).getValue() + "(" + ((JComboBoxItem) value).getKey() + ")");
		return this;
	}
}

class JComboBoxItem {
	private String key;
	private String value;
	private Vector<JComboBoxItem> childrenComboBoxItem = new Vector<JComboBoxItem>();

	@Override
	public String toString() {
		return key;
	}

	@Override
	public boolean equals(Object obj) {
		return obj != null && obj instanceof JComboBoxItem && key != null && key.equals(((JComboBoxItem) obj).getKey());
	}

	public JComboBoxItem(String key, String value) {
		this.key = key;
		this.value = value;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public Vector<JComboBoxItem> getChildrenComboBoxItem() {
		return childrenComboBoxItem;
	}

	public void setChildrenComboBoxItem(Vector<JComboBoxItem> childrenComboBoxItem) {
		this.childrenComboBoxItem = childrenComboBoxItem;
	}
}
